﻿using System;
using System.Collections.Generic;
using System.Text;
using IupNET;
using System.Drawing;

namespace ACTKTest
{
    public class InputQuery:Dialog
    {

        Text text;

        public InputQuery(Dialog parent)
        {

            Button btnok, btncancel;

            HBox ButtonRow = new HBox(
                new Fill(),
                btnok=new Button { Title = "OK" ,Action=OkClick},
                btncancel=new Button { Title = "Cancel",Action=CancelClick },
                new Fill()
            ) { Gap = 8, Margin = new Size2i(0, 0), NormalizeSize = NormalizeSize.Horizontal };


            
            Create(new VBox(
                new Label() {Title="Skriv här"},
                text = new Text() { Expand = Expand.Horizontal, Value = "Type here", Size = new Size2i(200, 0) },
                new Fill() { RasterSize = new Size2i(10, 10) },
                ButtonRow
                ) { Margin = new Size2i(10, 10) }
            );

            Topmost = true;
            ParentDialog = parent;
            Cursor=Cursor.Busy;

           

            LeaveWindowCB = leavewindow;
            EnterWindowCB = enterwindow;

            CloseCB = close;
        }

        void OkClick(CallbackData e)
        {
            Iupc.Message("ok","OK");
            Hide();
        }

        void CancelClick(CallbackData e)
        {
            HideTaskbar = true;
        }

        void leavewindow(CallbackData e)
        {
           
        }

        void enterwindow(CallbackData e)
        {
            
        }

        public void close(CallbackData e)
        {
            Iupc.Message("","On close");
        }

    }
}
